//package com.example.demo.service;
//
//import com.rabbitmq.client.Channel;
//import org.springframework.amqp.core.ExchangeTypes;
//import org.springframework.amqp.rabbit.annotation.Exchange;
//import org.springframework.amqp.rabbit.annotation.Queue;
//import org.springframework.amqp.rabbit.annotation.QueueBinding;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.amqp.support.AmqpHeaders;
//import org.springframework.messaging.handler.annotation.Header;
//import org.springframework.stereotype.Service;
//
//import java.io.IOException;
//
//@Service
//public class TopicListener {
//
//    @RabbitListener(queues = "buka")
//    public void handle(String msg, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG)long tag) throws IOException {
//        System.out.println("buka:" + msg);
//
////        System.out.println(1/0);
//        //确认消费成功
////        channel.basicAck(tag, false);//
//        //拒绝消息  不会放进队列
//        channel.basicReject(tag, false);
//        //拒绝    重新放回队列
////        channel.basicNack(tag, false, true);
//    }
//}
